import request from '@/router/axios'

export function fetchList(query) {
  return request({
    url: '/eims/saveMoneyCard/page',
    method: 'get',
    params: query
  })
}

export function addObj(obj) {
  return request({
    url: '/eims/saveMoneyCard',
    method: 'post',
    data: obj
  })
}

export function batchAddObj(obj) {
  return request({
    url: '/eims/saveMoneyCard/saveBatch',
    method: 'post',
    data: obj
  })
}

export function getObj(id) {
  return request({
    url: '/eims/saveMoneyCard/' + id,
    method: 'get'
  })
}

//详情(包含储值卡消费等记录)
export function getInfoObj(id) {
  return request({
    url: '/eims/saveMoneyCard/getInfo/' + id,
    method: 'get'
  })
}


export function delObj(id) {
  return request({
    url: '/eims/saveMoneyCard/' + id,
    method: 'delete'
  })
}

export function putObj(obj) {
  return request({
    url: '/eims/saveMoneyCard',
    method: 'put',
    data: obj
  })
}


export function openStatus(id) {
  return request({
    url: '/eims/saveMoneyCard/openStatus'+ id,
    method: 'get'
  })
}


export function editStatusById(id) {
  return request({
    url: '/eims/saveMoneyCard/editStatus/'+ id,
    method: 'get'
  })
}

export function batchOpenStatusByIds(ids) {
  return request({
    url: '/eims/saveMoneyCard/batchOpenStatus',
    method: 'post',
    data: ids
  })
}


export function batchCloseStatusByIds(ids) {
  return request({
    url: '/eims/saveMoneyCard/batchCloseStatus',
    method: 'post',
    data: ids
  })
}


export function batchRemoveByIds(ids) {
  return request({
    url: '/eims/saveMoneyCard/batchRemove',
    method: 'post',
    data: ids
  })
}

//充值/提现
export function saveCardTopUpOrWithdrawMoney(obj) {
  return request({
    url: '/eims/saveMoneyCard/topUpOrWithdrawMoney',
    method: 'post',
    data: obj
  })
}

//根据会员卡号集合分页查询储值卡记录
export function getCreditCardInfoPage(obj) {
  return request({
    url: '/eims/saveMoneyCard/getCreditCardInfoPageByCustomerCards',
    method: 'get',
    params: obj
  })
}

//储值卡金额清零
export function moneyReset() {
  return request({
    url: '/eims/saveMoneyCard/moneyReset',
    method: 'get'
  })
}

// excel模式导出
export function saveCardExportToExcel(query) {
  return request({
    url: '/eims/saveMoneyCard/saveCardExport/excel',
    method: 'post',
    data: query,
    responseType: 'blob'
  })
}
